<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-biz__homestaycomplaint}">
      <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
        <el-form-item>
          <el-input v-model="dataForm.creator" placeholder="投诉人用户名" clearable></el-input>
        </el-form-item>
        <el-form-item>
          <el-button @click="getDataList()">{{ $t('query') }}</el-button>
        </el-form-item>
        <el-form-item>
          <el-button type="info" @click="exportHandle()">{{ $t('export') }}</el-button>
        </el-form-item>
        <el-form-item>
          <el-button v-if="$hasPermission('biz:homestaycomplaint:save')" type="primary" @click="addOrUpdateHandle()">{{'投诉' }}</el-button>
        </el-form-item>
<!--        <el-form-item>-->
<!--          <el-button v-if="$hasPermission('biz:homestaycomplaint:delete')" type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>-->
<!--        </el-form-item>-->
      </el-form>
      <el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;">
        <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
        <el-table-column prop="homeName" label="民宿名称" header-align="center" align="center"></el-table-column>
        <el-table-column prop="creatorStr" label="投诉者" header-align="center" align="center"></el-table-column>
        <el-table-column prop="createDate" label="投诉时间" header-align="center" align="center"></el-table-column>
          <el-table-column prop="phone" label="预留电话" header-align="center" align="center"></el-table-column>
        <el-table-column prop="updaterStr" label="处理者" header-align="center" align="center"></el-table-column>
        <el-table-column prop="updateDate" label="处理时间" header-align="center" align="center"></el-table-column>
        <el-table-column prop="complaint" label="投诉内容" header-align="center" align="center"></el-table-column>
        <el-table-column prop="method" label="处理办法" header-align="center" align="center"></el-table-column>
        <el-table-column prop="stateStr" label="状态" header-align="center" align="center"></el-table-column>
        <el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
          <template slot-scope="scope">
            <el-button v-if="$hasPermission('biz:homestaycomplaint:update')" type="primary" size="small" @click="UpdateHandle(scope.row.id)">{{ '处理'}}</el-button>
<!--            <el-button v-if="$hasPermission('biz:homestaycomplaint:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>-->
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        :current-page="page"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="limit"
        :total="total"
        layout="total, sizes, prev, pager, next, jumper"
        @size-change="pageSizeChangeHandle"
        @current-change="pageCurrentChangeHandle">
      </el-pagination>
      <!-- 弹窗, 新增 / 修改 -->
      <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
      <!--  修改 -->
      <Update v-if="UpdateVisible" ref="Update" @refreshDataList="getDataList"></Update>
      <upload-up v-if="UploadUpVisible" ref="UploadUp" @refreshDataList="getDataList"></upload-up>
    </div>
  </el-card>
</template>

<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './homestaycomplaint-add-or-update'
import Update from './homestaycomplaint-update'
import UploadUp from './upload'
export default {
  mixins: [mixinViewModule],
  data () {
    return {
      mixinViewModuleOptions: {
        getDataListURL: '/biz/homestaycomplaint/page',
        getDataListIsPage: true,
        exportURL: '/biz/homestaycomplaint/export',
        deleteURL: '/biz/homestaycomplaint',
        deleteIsBatch: true
      },
      UploadUpVisible:false,
      UpdateVisible :false,
      dataForm: {
        id: ''
      }
    }
  },
  methods: {
    // 新增 / 修改
    handleClick1 (id ) {
      this.UploadUpVisible = true
      this.$nextTick(() => {
        this.$refs.UploadUp.dataForm.fid = id
        console.log(id)
        this.$refs.UploadUp.init()
      })
    },
  //修改
  UpdateHandle (id) {
    this.UpdateVisible = true
    this.$nextTick(() => {
      this.$refs.Update.dataForm.id = id
      this.$refs.Update.init()
    })
  },
  },
  components: {
    AddOrUpdate,
    Update,
    UploadUp
  }
}
</script>
